<include file="public:header" />

<style>
.grid-table .col-id { width: 50px; }
.grid-table .col-checkbox { text-align: center; width: 35px; }
.grid-table .col-role { text-align: left; width: 120px; }
.grid-table .col-name { text-align: left;  }
.grid-table .col-status { width: 50px;  }
.grid-table .col-time { width: 140px; }
.grid-table .col-action { text-align: center; width: 120px; }
</style>

   <form id="lkform" name="lkform" action="" data-list="{:U('activity/listing')}" data-delete="{:U('activity/delete')}" method="post" class="lkcmsform">

<table width="100%" cellspacing="0" class="filter-table">
<tbody>
<tr>
	<td width="100%" align="left">
	
	{:L('创建时间')}:
	<input type="text" name="_filter_starttime" id="_filter_starttime" value="{$filter_starttime}" class="input-text" size="10" maxlength="100" readonly>
	<input type="text" name="_filter_endtime" id="_filter_endtime" value="{$filter_endtime}" class="input-text" size="10" maxlength="100" readonly>
	
	
	{:L('筛选')}:
    
    <select id="_filter_fieldname" name="_filter_fieldname" >
		<option value=""> - {:L('全部')} - </option>
		<option value="title" <if condition="$filter_fieldname eq 'title'"> selected="selected"</if> > {:L('标题')} </option>
		<option value="content" <if condition="$filter_fieldname eq 'content'"> selected="selected"</if> > {:L('内容')} </option>
	</select>
	
	
    <input type="text" id="_f_search" name="_f_search" onchanges="form_list_submit(lkform);" class="" value="{$f_search}">

	<button onclick="form_list_submit(lkform);">{:L('开始')}</button>
	
	<!--
	<button onclick="
		document.getElementById('_f_order').value='';
		document.getElementById('_f_direc').value='';
		document.getElementById('_f_search').value='';

		document.getElementById('_filter_state').value='';
		form_list_submit(this.form);">{:L('清空')}</button>
	-->
	
	</td>
	<td nowrap="nowrap">
		<select id="_filter_state" name="_filter_state" onchange="form_list_submit(lkform);" data-value="{$filter_state}">
		<option value=""> - {:L('选择状态')} - </option>
		<option value="1" <if condition="$filter_state eq '1'"> selected="selected"</if> > {:L('发布')} </option>
		<option value="0" <if condition="$filter_state eq '0'"> selected="selected"</if> > {:L('隐藏')} </option>
		</select>
	</td>
</tr>
</tbody>
</table>

<table width="100%" cellspacing="0" class="grid-table style-joomla2">
<thead>
<tr>
	<th><input type="checkbox" value="" id="chkallid" name="chkallid" onclick="form_checkbox_selectall(this.form);"></th>
	<th><php>echo LkHTML::ListSort( L('id'), 'id', $f_order, $f_direc, 'form_ordering', L('按此列排序'));  </php></th>
	<th><php>echo LkHTML::ListSort( L('标题'), 'title', $f_order, $f_direc, 'form_ordering', L('按此列排序'));  </php></th>
	<th>{:L('是否置顶')}</th>
	<th>{:L('是否进行中')}</th>
    <th><php>echo LkHTML::ListSort( L('顺序'), 'sort', $f_order, $f_direc, 'form_ordering', L('按此列排序'));  </php></th>
    
	<th>{:L('创建时间')}</th>
	<th>{:L('修改时间')}</th>
	<th class="cell-action" nowrap="nowrap">{:L('状态')}</th>
	<th class="cell-action">操作</th>
</tr>
</thead>
<tbody>
<volist name="dataset" id="rec" >
<tr>
	<td class="cell-checkbox"><input type="checkbox" value="{$rec['id']}" name="id[]" /></td>
	<td class="cell-id">{$rec['id']}</td>
	<td>{$rec['title']}</td>
	<td><if condition="$rec.is_top eq '1'">是</if><if condition="$rec.is_top eq '0'">&nbsp;</if></td>
	<td><if condition="$rec.is_active eq '0'">正在进行</if><if condition="$rec.is_active eq '1'">已截止</if></td>
    <td>{$rec['sort']}</td>
	<td class="cell-time">{$rec.create_time|date='Y-m-d H:i:s',###}</td>
	<td class="cell-time">{$rec.modify_time|date='Y-m-d H:i:s',###}</td>
	<td class="cell-status"><a <?php if($CurrAccount['Account-Role']=='administrator' || $CurrAccount['Account-Role']=='admin'){ ?>href="javascript:table_change_status({$rec['id']},'form_record_status')"<?php }?> id="form_record_status_{$rec['id']}"><img src="__ROOT__/statics/images/status_{$rec['status']}.gif" /></a></td>
	<td class="cell-action"><a href="{:U('activity/edit', array('id'=>$rec['id']))}" class="action action-edit">{:L('编辑')}</a></td>
</tr>
</volist>
</tbody>
<tfoot>
<tr><td colspan="12">
	<!--<label for="check_box" style="float:left;">全选/取消</label>-->
	<?php if($CurrAccount['Account-Role']=='administrator' || $CurrAccount['Account-Role']=='admin'){ ?><input type="submit" class="button" name="dosubmit" value="删除" onclick="return confirm('你确定要删除吗？')" style="float:left;margin-left:10px;"/><?php }?>
	<div id="pages">{$page}</div>
</td></tr>
</tfoot>
</table>


       <input type="hidden" name="_f_order" value="{$f_order}" />
       <input type="hidden" name="_f_direc" value="{$f_direc}" />


</form>


<script language="javascript">

    function form_ordering( order, dir, task ) {
        var form = document.lkform;
        form._f_order.value = order;
        form._f_direc.value = dir;
        form.submit( task );
    }

function form_checkbox_selectall(form){
	LkCmsForm.CheckBoxAll(form, 'name', 'id[]', 'chkallid');
}
function form_list_submit(form){
	$ = jQuery;
	$(form).prop('action', $(form).data('list'));
	$(form).submit();
}
function form_delete_submit(form){
//	$ = jQuery;
//	$(form).prop('action', $(form).data('delete'));	
//	var ids='';
//	$(form).children("input[name='id[]']:checked").each(function(i, n){
//		ids += $(n).val() + ',';
//	});
//	var info = "{:L('请选择你需要删除的用户')}";
//	if(ids=='') {
//		window.top.art.dialog({content:info,lock:true,width:'200',height:'50',time:1.5},function(){});
//		return false;
//	}
//	form.submit();
}
function table_change_status(id, type){
    $.get("{:U('activity/ajax_change_status')}", { id: id, type: type }, function(jsondata){
    	var status = jsondata.status;
    	var result = jsondata.result;
    	if( status == 'true'){
			$("#"+type+"_"+id+" img").attr('src', '__ROOT__/statics/images/status_'+ result +'.gif');
    	}
	}); 
}

;(function($){
	$(document).ready(function(){
		

	});

})(jQuery);
</script>

    <link href="__ROOT__/scripts/timefiles/style.css" rel="stylesheet" type="text/css" />
    <link href="__ROOT__/scripts/timefiles/ui.datepicker.css" rel="stylesheet" type="text/css" />
    <link href="__ROOT__/scripts/timefiles/ui.theme.css" rel="stylesheet" type="text/css" />
    <link href="__ROOT__/scripts/timefiles/ui.core.css" rel="stylesheet" type="text/css" />
    <script src="__ROOT__/scripts/timefiles/ui.datepicker.js" type="text/javascript"></script>
    <script type="text/javascript">
         $(function() {
             $("#_filter_starttime").datepicker();
             $("#_filter_endtime").datepicker();
         });
	</script>
	
<include file="public:footer" />